<!-- created:2023/2/16 16:17 By AdinZ -->
<template>
  <div class="InviteRecord">
    <el-table :data="list" border stripe style="width: 100%">
      <el-table-column type="index" width="50" label="#"/>

      <el-table-column label="发邀会员" width="180" align="center">
        <template #default="data">
          <div class="flex flex-center" v-if="data.row.inviteUser">
            <img :src="data.row.inviteUser.avatar" style="width:60px;height: 60px">
            <div class="nickname flex1">
              {{ data.row.inviteUser.mobile }}
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="被邀会员" width="180" align="center">
        <template #default="data">
          <div class="flex flex-center" v-if="data.row.user">
            <img :src="data.row.user.avatar" style="width:60px;height: 60px">
            <div class="nickname flex1">
              {{ data.row.user.mobile }}
            </div>
          </div>
        </template>
      </el-table-column>

      <el-table-column prop="status" label="状态" width="100" align="center">
        <template #default="data">
          <span v-if="data.row.shareAward==0">未奖励</span>
          <span v-if="data.row.shareAward==1">已奖励</span>
        </template>
      </el-table-column>
      <el-table-column prop="shareAmount" label="奖金" width="100" align="center"/>

      <el-table-column prop="created" label="下单时间" width="180" align="center">
        <template #default="data">
          {{ parseTime(data.row.created) }}
        </template>
      </el-table-column>
      <el-table-column prop="remark" label="系统备注" width="200" align="center"/>

    </el-table>

    <el-pagination :current-page="query.page" :page-size="query.size" @current-change="getList"
                   @size-change="getList" background
                   layout="sizes,prev, pager, next"
                   :total="query.total"/>
  </div>
</template>

<script>
import {parseTime} from "../../../utils";

export default {
  name: "InviteRecord",
  props: {
    data: {type: Object}
  },
  data() {
    return {
      list: [],
      query: {
        page: 1,
        size: 20,
        aid: this.data.id,
        direction: 'DESC',
        properties: ['id']
      }
    }
  },
  created() {
    this.getList();
  },
  methods: {
    parseTime,
    getList() {
      this.$api.apiQuery('/api/manage/activity/invite-record/', this.query).then(res => {
        this.list = res.data;
        this.query.total = res.total;
      })
    }
  }
}
</script>

<style scoped lang="scss">
.InviteRecord {

}
</style>
